<?php

/**
 * Contains a function to safely return a value from an array.
 *
 * PHP Version 5
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */

/**
 * A function to safely return a value from an array.
 *
 * @param array  $array The source array.
 * @param string $key   The array key to retrieve.
 *
 * @access public
 * @return string       The value, if it exists, or blank if it does not.
 */
function valueOf($array, $key)
{
    if (!is_array($array)) {
        return '';
    }
    return (array_key_exists($key, $array)) ? $array[$key] : '';
}

?>